<template>
  <div class="route-detail">
    <mt-header title="路线需求详情" fixed>
      <router-link to slot="left">
        <mt-button icon="back" @click.native="$router.back(-1)"></mt-button>
      </router-link>
      <mt-button icon="more" slot="right"></mt-button>
    </mt-header>

    <div class="personal-info">
      <h3>需求发起人</h3>
      <div class="info">
        <div class="icon-swapper" @click="$router.push('/personal/' + user.id + '/read')">
          <img
            v-if="user.iconUrl == null || user.iconUrl == ''"
            src="static/img/server/usericon.png"
            height="80px"
          />
          <img v-else :src="$platIMG + user.iconUrl" height="80px" />
        </div>
        <div class="text-swapper">
          <div class="wrapper-info">
            <div class="info-text">{{user.nickName}}</div>
            <div class="info-text">当前角色：{{isGuideText}}</div>
            <div class="wrapper-detail" @click="$router.push('/personalData/'+ user.id)">
              <span slot="icon" class="iconfont">&#xe60a;</span>
              个人详细信息
              <span slot="icon" class="iconfont icon-angle-right">&#xe614;</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="route-content">
      <h3>行程内容</h3>
      <div class="content-list">
        <mt-cell class="cell" title="出发时间" :value="dataForm.startTime"></mt-cell>
        <mt-cell class="cell" title="目的地" :value="dataForm.destName"></mt-cell>
        <mt-cell class="cell" title="人数" :value="dataForm.maxNum"></mt-cell>
        <mt-cell class="cell" title="拼团玩" :value="isShareText"></mt-cell>
        <mt-cell class="cell" title="向导需求" :value="dataForm.guideDemand"></mt-cell>
        <mt-cell class="cell" title="期望玩法" :value="dataForm.playWay"></mt-cell>
        <mt-cell class="cell" title="必玩景点" :value="dataForm.necessaryAttraction"></mt-cell>
        <mt-cell class="cell" title="预算范围(元)" :value="dataForm.budget"></mt-cell>
        <mt-cell class="cell" title="用车与否" :value="useCarText"></mt-cell>
        <mt-cell class="cell" title="联系方式" :value="dataForm.contact"></mt-cell>
        <mt-cell class="cell" title="补充信息" :value="dataForm.note"></mt-cell>
      </div>
    </div>

    <div class="submit-cancel">
      <div class="cancel" @click="$router.go(-1)">取消</div>
      <div class="submit" >我要服务</div>
    </div>
  </div>
</template>

<script>
import { fetchGetData, fetchPostData } from "@/api/fetch.js";
import { getDictionaryKey } from "@/libs/util.js";
export default {
  name: "routeReqDetail",
  data() {
    return {
      user: {},
      dataForm: {},
      isShareText: "",
      useCarText: "",
      isGuideText: ""
    };
  },
  props: [],
  methods: {},
  mounted() {
    fetchGetData("/api/route/detail", {
      id: this.$route.params.id
    }).then(data => {
      if (data.status == 1) {
        this.dataForm = data.data;
        this.isShareText = getDictionaryKey("key1001", this.dataForm.isShare);
        this.useCarText = getDictionaryKey("key1001", this.dataForm.useCar);
      } else {
        console.log("fail");
      }
    });
    fetchGetData("/api/user/detail", { id: this.$route.params.creator }).then(
      data => {
        if (data.status == 1) {
          this.user = data.data;
          this.isGuideText = getDictionaryKey("key1004", this.user.isGuide);
        } else {
          console.log("fail");
        }
      }
    );
  }
};
</script>

<style lang="stylus" scoped>
@import '~@/assets/style/modifyMintUIColor.styl';

.route-detail {
  padding-top: 40px;
  padding-bottom 55px;
  box-sizing: border-box;

  .mint-header>>>.mint-header-title {
    font-size: 0.4rem;
  }

  .personal-info {
    padding: 0.3rem;
    border-bottom: 10px solid #eee;

    h3 {
      font-weight: bolder;
      font-size: 0.36rem;
      margin-bottom: 0.3rem;
    }

    .info {
      display: flex;

      .icon-swapper {
        border-radius: 0.8rem;
        width: 1.6rem;
        height: 1.6rem;
        overflow: hidden;
        float: left;
      }

      .text-swapper {
        flex: 1;
        // background-color: green;
        margin-left: 0.2rem;

        .wrapper-info {
          margin-left: 0.2rem;

          .info-text {
            height: 0.4rem;
            line-height: 0.4rem;
          }

          .wrapper-detail {
            height: 0.6rem;
            line-height: 0.6rem;
            margin-top: 0.2rem;
            padding: 0 0.2rem;
            background-color: #eee;
            border-radius: 0.1rem;
          }
        }
      }
    }
  }

  .route-content {
    padding: 0.3rem 0.3rem;

    h3 {
      font-weight: bolder;
      font-size: 0.36rem;
      margin-bottom: 0.3rem;
    }
  }

  .submit-cancel {
    height: 55px;
    z-index: 999;
    display: flex;
    line-height: 55px;
    text-align: center;
    position: fixed;
    width: 100%;
    bottom: 0;

    .cancel {
      flex: 1;
      background-color: #efefef;
    }

    .submit {
      flex: 1;
      background-color: $themeColor;
      color: #fff;
    }
  }
}
</style>